package com.ciis.system.role.service.impl;

import com.ciis.system.role.domain.TSysRole;
import com.ciis.system.role.mapper.ITSysRoleMapper;
import com.ciis.system.role.service.ISysRoleService;
import org.springframework.beans.factory.annotation.Autowired;

import java.util.List;

/**
 * Created with IntelliJ IDEA.
 * User: zhangdajun
 * Date: 14-6-1
 * Time: 上午10:59
 * To change this template use File | Settings | File Templates.
 */
public class SysRoleServiceImpl implements ISysRoleService {

    @Autowired
    ITSysRoleMapper roleMapper;

    @Override
    public void save(TSysRole role) throws Exception {
        roleMapper.save(role);
    }

    @Override
    public void delete(String idStr) throws Exception {
        String ids[] = idStr.split(",");
        for(String id : ids){
            roleMapper.delete(id);
        }
    }

    @Override
    public void deleteRoleByGId(String groupId) throws Exception {
        roleMapper.deleteRoleByGId(groupId);
    }

    @Override
    public void update(TSysRole role) throws Exception {
        roleMapper.update(role);
    }

    @Override
    public TSysRole getSysRolesById(String id) throws Exception {
        return roleMapper.getSysRolesById(id);
    }

    @Override
    public List<TSysRole> getSysRoleByGId(String groupId) throws Exception {
        return roleMapper.getSysRoleByGId(groupId);
    }

    @Override
    public List<TSysRole> getGroupRole(String groupId) throws Exception {
        return roleMapper.getGroupRole(groupId);
    }
}
